package org.pf.base.pfStorages
{
	import Box2D.Dynamics.Joints.b2FrictionJointDef;
	import org.pf.base.pfBlocks.PFSemaphore;
	
	/**
	 * ...
	 * @author
	 */
	public class PFStorageSemaphores
	{
		private var _semaphoresList:Array;
		
		public function PFStorageSemaphores()
		{
			_semaphoresList = new Array();
		}
		
		public function setSemaphore(semaphore:PFSemaphore):void
		{
			_semaphoresList.push(semaphore);
		}
		
		public function getSemaphore(semaphoreName:String):PFSemaphore
		{
			var i:int = 0;
			var sem:PFSemaphore;
			while (i < _semaphoresList.length)
			{
				if (_semaphoresList[i].name == semaphoreName)
				{
					sem = _semaphoresList[i];
					break;
				}
				else
				{
					i++;
				}
				
			}
			return sem;
		}
		
		public function removeSemaphore(semaphoreName:String):void
		{
			var i:int = 0;
			while (i < _semaphoresList.length)
			{
				if (_semaphoresList[i].name == semaphoreName)
				{
					_semaphoresList = _semaphoresList.splice[_semaphoresList[i]];
					break;
				}
				else
				{
					i++;
				}
			}
		}
	
	}

}